package nontermin;

import frontend.Token;

import java.io.FileWriter;
import java.io.IOException;

public class Terminator implements Sign {
    private final Token token;
    public Terminator(Token token) {
        this.token = token;
    }

    @Override
    public boolean isEmpty() {
        return token == null;
    }

    @Override
    public void output(FileWriter writer) {
        //System.out.println(token.toString());
            // 向文件中写入内容
        try {
            writer.write(token.toString() + '\n');
        } catch (IOException e) {
            // 捕获并处理可能发生的IO异常
            System.out.println("An error occurred while writing to the file.");
            e.printStackTrace();
        }
    }
}
